{% block sw_settings_units_detail %}
<sw-page class="sw-settings-units">

    <template #smart-bar-actions>

        <sw-button-process
            class="sw-settings-units__create-action"
            variant="primary"
            :is-loading="isLoading"
            :process-success="isSaveSuccessful"
            :disabled="!acl.can('scale_unit.editor')"
            @click="onSave"
        >
            {{ $tc('global.default.save') }}
        </sw-button-process>

    </template>

    <template #language-switch>
        <sw-language-switch
            :disabled="unit === null || unit.isNew()"
            @on-change="onChangeLanguage"
        />
    </template>

    <template #content>
        <sw-card-view>
            <mt-card
                v-if="!isLoading"
                position-identifier="sw-settings-units-content"
            >

                <mt-text-field
                    v-model="unit.name"
                    name="sw-field--unit-name"
                    :label="$tc('sw-settings-units.detail.fieldLabels.name')"
                    :error="unitNameError"
                    required
                />

                <mt-text-field
                    v-model="unit.shortCode"
                    name="sw-field--unit-shortCode"
                    :label="$tc('sw-settings-units.detail.fieldLabels.shortCode')"
                    :error="unitShortCodeError"
                    required
                />
                <sw-custom-field-set-renderer
                    :entity="unit"
                    :sets="customFieldSets"
                    :disabled="!acl.can('unit.editor')"
                />
            </mt-card>

            <sw-skeleton v-else />
        </sw-card-view>
    </template>
</sw-page>
{% endblock %}
